home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / info-service / wais / ir-book-sources / mphf / rantab.c < prev    next >
C/C++ Source or Header  |  1993-04-08  |  1KB  |  41 lines

  1. /******************************  rantab.c  **********************************
  2.  
  3.   Purpose:    Routines for handling the random number tables.
  4.  
  5.   Provenance:    Written and tested by Q. Chen and E. Fox, March 1991.
  6.           Edited and tested by S. Wartik, April 1991.
  7.  
  8.   Notes:    None.
  9.  
  10. **/
  11.  
  12.  
  13. #include "types.h"
  14. #include "pmrandom.h"
  15. #include "rantab.h"
  16.  
  17. /*************************************************************************
  18.  
  19.     initialize_randomTable( randomTablesType, int )
  20.  
  21.   Return:    void
  22.   
  23.   Purpose:    Initialize the three random number tables and return the seed
  24.         used.
  25. **/
  26.  
  27. void initialize_randomTable( tables, seed )
  28.     randomTablesType tables;    /* out: Tables of random numbers.    */
  29.     int             *seed;    /* out: seed used to initialize tables. */
  30. {
  31.     int i, j, k;          /* Iterators over the tables.        */
  32.  
  33.     *seed = getseed();
  34.     setseed( *seed );
  35.  
  36.     for ( i = 0; i < NO_TABLES; i++ )          /* Initialize the tables. */
  37.     for ( j = 0; j < ROWS; j++ )
  38.         for ( k = 0; k < COLUMNS; k++ )
  39.         tables[i][j][k] = pmrandom();
  40. }
  41.